from game import zz_game
from zz import zz_log, zz_img

log = zz_log.of()


class Game(zz_game.ZZ_Game):
    def __init__(self, d, has_prize=True):
        super().__init__(d, has_prize)

    def get_name(self):
        return "猎场HD"

    def game_alert(self):
        while True:
            if self.alert_close('./game/img/猎场HD/alert.png', 2):
                continue
            break

    def handle_main(self):
        self.log_msg("等待进入游戏页面")
        self.img_exit("./game/img/猎场HD/go.png", 20)
        self.log_msg("点击开始游戏")
        self.img_click("./game/img/猎场HD/go.png")

        if self.not_prize_handle():
            return False

        self.game_alert()

        self.img_click_if_exists('点击招募', './game/img/猎场HD/chou.png', './game/img/猎场HD/chou01.png')
        self.log_msg("进行高级召唤")
        self.img_click('./game/img/猎场HD/chou01.png')
        self.alert_close('./game/img/猎场HD/alert01.png', 1)
        self.alert_close('./game/img/猎场HD/alert01.png', 1)

        self.log_msg("进行第2次高级召唤")
        self.img_click('./game/img/猎场HD/chou01.png')
        self.alert_close('./game/img/猎场HD/alert01.png', 1)
        self.alert_close('./game/img/猎场HD/alert01.png', 1)

        self.log_msg("进行基础召唤")
        self.img_click('./game/img/猎场HD/chou02.png')
        self.img_click('./game/img/猎场HD/chou01.png')

        # self.d.sleep(2)
#        self.close_game()
